<template>
  <div class="layout-aside-container">
    <!-- 标题区域 -->
    <div class="title">用户权限管理系统</div>
    <!-- 左侧边栏列表 -->
    <el-row class="tac">
      <el-col :span="24">
        <el-menu default-active="2" class="el-menu-vertical-demo" router>
          <el-submenu index="1">
            <template slot="title">
              <span style="font-size: large;">用户主页</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/main">
                <i class="el-icon-location"></i>
                后台主页
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
          <el-submenu index="2">
            <template slot="title">
              <span style="font-size: large;">管理菜单</span>
            </template>
            <el-menu-item-group>
              <el-menu-item index="/users">
                <i class="el-icon-user-solid"></i>
                用户管理
              </el-menu-item>
            </el-menu-item-group>
            <el-menu-item-group>
              <el-menu-item index="/roles">
                <i class="el-icon-s-order"></i>
                角色管理
              </el-menu-item>
            </el-menu-item-group>
            <el-menu-item-group>
              <el-menu-item index="/menus">
                <i class="el-icon-menu"></i>
                菜单管理
              </el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { mapActions, mapState } from 'vuex'

export default {
  name: 'MyAside',
  methods: {
    ...mapActions('Home', ['gettypeList'])
  },
  created() {
    this.gettypeList()
  },
  computed: {
    ...mapState('Home', ['typeList'])
  }
}
</script>

<style lang="less" scoped>
.icon {
  margin-right: 30px;
}
.title {
  height: 100px;
  font-size: 20px;
  text-align: center;
  line-height: 100px;
}
.layout-aside-container {
  height: 100%;
  border-right: 1px solid #eaeaea;
}

.menu {
  list-style-type: none;
  padding: 0;
  .menu-item {
    line-height: 50px;
    font-weight: bold;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,
      'Open Sans', 'Helvetica Neue', sans-serif;
    &:hover {
      background-color: #efefef;
      cursor: pointer;
    }
    a {
      display: block;
      color: black;

      &:hover {
        text-decoration: none;
      }
    }
  }
}

// 设置路由高亮效果
.router-link-active {
  background-color: #efefef;
  box-sizing: border-box;
  position: relative;
  // 伪元素实现路由高亮效果
  &::before {
    content: ' ';
    display: block;
    width: 4px;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    background-color: #42b983;
  }
}
</style>
